OTGetProtAddress
Obtains the address to which an endpoint is bound and, if the endpoint is currently connected, obtains the address of its peer.C INTERFACE
OSStatus OTGetProtAddress (EndpointRef ref, TBind* boundAddr, TBind* peerAddr)C++ INTERFACE
OSStatus TEndpoint::GetProtAddress (TBind* boundAddr, TBind* peerAddr);PARAMETERS
ref
- The endpoint reference of the endpoint whose local and peer address is sought.
boundAddr
- A pointer to a
TBind
structure (page 3-51). TheboundAddr->addr
field is aTNetBuf
structure that describes the address of the endpoint specified by theref
parameter. You must allocate a buffer for the address information and
initialize theaddr.buf
field to point to that buffer. You must also initialize theaddr.maxlen
field to the maximum size of
the address.- If you are calling this function only to determine the address of the peer endpoint, you can set the
boundAddr
parameter toNIL
.- The
boundAddr->qlen
field is ignored.peerAddr
- A pointer to a
TBind
structure (page 3-51). If the endpoint specified by theref
parameter is currently connected, thepeerAddr->addr
field is aTNetbuf
structure that describes
the address of the endpoint's peer. TheboundAddr->qlen
field
is ignored.DESCRIPTION
TheOTGetProtAddress
function returns the address to which an endpoint is bound in theboundAddr
parameter and, if the endpoint is currently connected, the address of its peer in thepeerAddr
parameter. Not all endpoints support this function. A value ofT_XPG4_1
in theflags
field of theTEndpointInfo
structure indicates that the endpoint does support this function.You are responsible for initializing the buffers required to hold the local and peer addresses. The
addr
field of theTEndpointInfo
structure specifies the maximum amount of memory needed to store the address of an endpoint. Use this value to set the size of the buffers.The information returned by the
OTGetProtAddress
function is affected by the state of the endpoint specified by theref
parameter. If the endpoint is in theT_UNBND
state, theboundAddr->addr.len
field is set to 0. If the endpoint is not in theT_DATAXFER
state, thepeerAddr->addr.len
field is set to 0.If the endpoint is in asynchronous mode and a notifier is not installed, it is not possible to determine when the function completes.
COMPLETION EVENT CODES
T_GETPROTADDRCOMPLETE
0x20000008 The OTGetProtAddress
function has completed. Thecookie
parameter of the notifier function contains thepeerAddr
parameter unless it isnil
, in which case thecookie
parameter contains theboundAddr
parameter.VALID STATES
AllSEE ALSO
TheTBind
structure (page 3-51) describes the address to which an endpoint
is bound.The
flags
field of theTEndpointInfo
structure (page 3-45) indicates whether the endpoint supports this function.For information on how to use this function with a TCP/IP protocol, see page 8-17 in the TCP/IP chapter.
For more information about the peer endpoint, see the description of the
OTAccept
function (page 3-127).